file object

This method will move the file cursor to a new position.

bool seek(double new_position)

Parameters:
new_position
The position to seek to. 0 indicates the beginning of the file.

Return value:
true on success, false on failure.

Remarks:
If the file is opened in text mode, the number given in the new_position parameter specifies the position in characters. If, on the other hand, the file is opened as binary, then the number specifies the position in bytes instead.

If the file is opened in write or append mode and you seek to a position prior to the end of the file and write data, the data previously stored at that position will be overwritten.

Example:
// Read character 5 in a file.

void main()
{
file test;
test.open("test.txt", "r");
test.seek(4); // We use 4 because the cursor moves one when we read or write.
alert("character 5", "character5="+test.read(1));
}